import React from 'react'
import { useLocation, useParams, useSearchParams } from 'react-router-dom'
export default function About() {
  const location = useLocation() //接收location.state
  const params = useParams() //接收路由参数
  const [query, setQuery] = useSearchParams() //接收路由参数
  // console.log(location)
  // console.log(params)
  console.log(query.get('name'))
  console.log(query.get('age'))
  return (
    <div>
      <h2>About</h2>
      <button
        onClick={() => {
          setQuery('name=xxx&age=yyy')
        }}
      >
        修改查询字符串
      </button>
    </div>
  )
}
